package example.simple_mindmap.handler;

import cn.hutool.core.util.StrUtil;
import example.simple_mindmap.common.designs.chain1.ChainData;
import example.simple_mindmap.common.designs.chain1.ChainHandler;
import example.simple_mindmap.common.utils.DataUtil;
import example.simple_mindmap.domain.po.MindMap;

public class CheckParam extends ChainHandler {

    @Override
    public ChainData process(ChainData chainData) {
        MindMap mindMap = chainData.getData(MindMap.class);
        if(mindMap == null
                || DataUtil.isNaturalNumInvalid(mindMap.getId())
                || StrUtil.isBlank(mindMap.getTitle())
                || StrUtil.isBlank(mindMap.getNodeList())){
            return ChainData.getAbnormal("参数检验失败");
        }
        return chainData;
    }
}
